package com.asset.salesforce.model;
import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import com.asset.salesforce.jacksonConvertor.CustomDateSerializer;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@SuppressWarnings("serial")
@Table(name= "contact")
@Entity
@JsonRootName(value="contacts")
public class Contact implements Serializable{
	@JsonInclude(Include.NON_NULL)
	private Integer id;
	@JsonIgnore
	private Employee creator;
	@JsonInclude(Include.NON_NULL)
	  
	private String creatorName;
	@JsonInclude(Include.NON_NULL)
	private Integer creatorId;
	  
	@JsonInclude(Include.NON_NULL)
	private Integer parentId;
	@JsonInclude(Include.NON_NULL)
	private String leadSource;
	@JsonInclude(Include.NON_NULL)
	private String fName;
	@JsonInclude(Include.NON_NULL)
	private String lName;
	@JsonInclude(Include.NON_NULL)
	private String title;
	@JsonInclude(Include.NON_NULL)
	private String phone;
	@JsonInclude(Include.NON_NULL)
	private String mobile;
	@JsonInclude(Include.NON_NULL)
	private String email;
	@JsonInclude(Include.NON_NULL)
	private String gender;
	@JsonInclude(Include.NON_NULL)
	private Date date;
	@JsonInclude(Include.NON_NULL)
	private Boolean isDeleted = false;
	@JsonInclude(Include.NON_NULL)
	private Boolean isFollowed = false;
	@JsonInclude(Include.NON_NULL)
	private String viewType;
	@JsonInclude(Include.NON_NULL)
	private String parentName;
	@JsonInclude(Include.NON_NULL)
	private Date dateCreated;
	@JsonInclude(Include.NON_NULL)
	private Date dateModified;
	@JsonInclude(Include.NON_NULL)
	  
	private String companyName;
	@JsonIgnore
	private Lead leadId;
	@JsonInclude(Include.NON_NULL)
	  
	private String accountName;
	/**
	 * @return the id
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.SEQUENCE ,generator="contact_id_seq")
	@SequenceGenerator(name="contact_id_seq",sequenceName="contact_id_seq",allocationSize=1)
	public Integer getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * @return the fName
	 */
	@Column(name="fname")
	public String getfName() {
		return fName;
	}

	/**
	 * @param fName the fName to set
	 */
	public void setfName(String fName) {
		this.fName = fName;
	}

	/**
	 * @return the lName
	 */
	@Column(name="lname")
	public String getlName() {
		return lName;
	}

	/**
	 * @param lName the lName to set
	 */
	public void setlName(String lName) {
		this.lName = lName;
	}

	/**
	 * @return the title
	 */
	@Column(name="title")
	public String getTitle() {
		return title;
	}

	/**
	 * @param title the title to set
	 */
	public void setTitle(String title) {
		this.title = title;
	}

	/**
	 * @return the phone
	 */
	@Column(name="phone")
	public String getPhone() {
		return phone;
	}

	/**
	 * @param phone the phone to set
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="creator_id")
	public Employee getCreator() {
		return creator;
	}

	public void setCreator(Employee creator) {
		this.creator = creator;
	}
	
	
	@Column(name="account_id")
	public Integer getParentId() {
		return parentId;
	}

	public void setParentId(Integer parentId) {
		this.parentId = parentId;
	}

	
	@Column(name="lead_source")
	public String getLeadSource() {
		return leadSource;
	}

	public void setLeadSource(String leadSource) {
		this.leadSource = leadSource;
	}

	/**
	 * @return the mobile
	 */
	@Column(name="mobile")
	public String getMobile() {
		return mobile;
	}

	/**
	 * @param mobile the mobile to set
	 */
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	/**
	 * @return the email
	 */
	@Column(name="email")
	public String getEmail() {
		return email;
	}

	/**
	 * @param email the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @return the gender
	 */
	@Column(name="gender")
	public String getGender() {
		return gender;
	}

	/**
	 * @param gender the gender to set
	 */
	public void setGender(String gender) {
		this.gender = gender;
	}

	/**
	 * @return the date
	 */
	@Column(name="date")
	@JsonSerialize(using= CustomDateSerializer.class)
	public Date getDate() {
		return date;
	}

	/**
	 * @param date the date to set
	 */
	public void setDate(Date date) {
		this.date = date;
	}

	/**
	 * @return the isDeleted
	 */
	@Column(name="is_deleted")
	public Boolean getIsDeleted() {
		return isDeleted;
	}

	/**
	 * @param isDeleted the isDeleted to set
	 */
	public void setIsDeleted(Boolean isDeleted) {
		this.isDeleted = isDeleted;
	}

	/**
	 * @return the isFollowed
	 */
	@Transient  
	public Boolean getIsFollowed() {
		return isFollowed;
	}

	/**
	 * @param isFollowed the isFollowed to set
	 */
	public void setIsFollowed(Boolean isFollowed) {
		this.isFollowed = isFollowed;
	}
	
	@Column(name="parent_type")
	public String getViewType() {
		return viewType;
	}

	public void setViewType(String viewType) {
		this.viewType = viewType;
	}
	@Column(name="parent_name")
	public String getParentName() {
		return parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}
	/**
	 * @return the dateCreated
	 */
	@Temporal(value = TemporalType.TIMESTAMP)
	@Column(name="date_created")
	@JsonSerialize(using= CustomDateSerializer.class)
	public Date getDateCreated() {
		return dateCreated;
	}
	/**
	 * @param dateCreated the dateCreated to set
	 */
	public void setDateCreated(Date dateCreated) {
		this.dateCreated = dateCreated;
	}
	/**
	 * @return the dateModified
	 */
	@Temporal(value = TemporalType.TIMESTAMP)
	@Column(name="date_modified")
	@JsonSerialize(using= CustomDateSerializer.class)
	public Date getDateModified() {
		return dateModified;
	}
	/**
	 * @param dateModified the dateModified to set
	 */
	public void setDateModified(Date dateModified) {
		this.dateModified = dateModified;
	}

	/**
	 * @return the leadId
	 */
	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="lead_id")
	public Lead getLeadId() {
		return leadId;
	}

	/**
	 * @param leadId the leadId to set
	 */
	public void setLeadId(Lead leadId) {
		this.leadId = leadId;
	}

	/**
	 * @return the creatorId
	 */
	public Integer getCreatorId() {
		return creatorId;
	}

	/**
	 * @param creatorId the creatorId to set
	 */
	public void setCreatorId(Integer creatorId) {
		this.creatorId = creatorId;
	}

	/**
	 * @return the creatorName
	 */
	@Transient
	public String getCreatorName() {
		return creatorName;
	}

	/**
	 * @param creatorName the creatorName to set
	 */
	public void setCreatorName(String creatorName) {
		this.creatorName = creatorName;
	}
	/**
	 * @return the companyName
	 */
	@Transient
	public String getCompanyName() {
		return companyName;
	}

	/**
	 * @param companyName the companyName to set
	 */
	public void setCompanyName(String companyName) {
		this.companyName = companyName;
	}

	/**
	 * @return the accountName
	 */
	@Transient
	public String getAccountName() {
		return accountName;
	}

	/**
	 * @param accountName the accountName to set
	 */
	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}
	
}
